﻿using System.Net.Mail;
using Netkk.Common;
using Netkk.Common.Interfaces.Services;

namespace Netkk.Library.Services
{
    public class SendmailService : ISendmailService
    {
        public MailAddress Sender { get; set; }
        public bool IsHtmlMail { get; set; }

        public void Sendmail(MailAddress receiver, string subject, string mailBody)
        {
            Sendmail(new MailAddressCollection { receiver }, subject, mailBody, Sender);
        }
        public void Sendmail(MailAddress receiver, string subject, string mailBody, MailAddress replyTo)
        {
            Sendmail(new MailAddressCollection { receiver }, subject, mailBody, replyTo);
        }
        public void Sendmail(MailAddressCollection receivers, string subject, string mailBody)
        {
            Sendmail(receivers, subject, mailBody, Sender);
        }
        public void Sendmail(MailAddressCollection receivers, string subject, string mailBody, MailAddress replyTo)
        {
            Sendmail sendMail = new Sendmail(Sender)
            {
                IsHtml = IsHtmlMail
            };
            sendMail.Send(receivers, subject, mailBody, replyTo);
        }
    }
}
